﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace StarterKits.Mvc.Membership.ComponentControllers
{
	public class FormsAuthenticationComponentController : ComponentController
	{
		public virtual void LoginStatus()
		{
			var viewData = new LoginStatusData
			{
				IsLoggedIn = this.Context.HttpContext.User.Identity.IsAuthenticated,
				UserName = this.Context.HttpContext.User.Identity.Name
			};
			RenderView( "LoginStatus", viewData );
		}

		public virtual void LoginName()
		{
			string loginName = this.Context.HttpContext.User.Identity.IsAuthenticated ?
                this.Context.HttpContext.User.Identity.Name : "Anonymous";
            RenderView("LoginName", loginName);
		}
	}

	public class LoginStatusData
	{
		public bool IsLoggedIn { get; set; }
		public string UserName { get; set; }
	}
}
